/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tuplegenerator;

/**
 *
 *
 */
public class MeterUser extends Tuple {
    
    private int meterID = -1;
    private String username = null;

    public MeterUser(int id, String uname) {
        meterID = id;
        username = uname;
    }

    public void setMeterID(int meterID) {
        this.meterID = meterID;
    }

    public int getMeterID() {
        return meterID;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public String toString() {
        return meterID + ";" + username;
    }
    
    public static MeterUser parse(String data) {
        String[] parts = data.split("[;]");
        return new MeterUser(Integer.parseInt(parts[0]), parts[1]);
    }

    @Override
    public int getKey() {
        return meterID;
    }

	@Override
	public int compareTo(Tuple o) {
		MeterUser mu = (MeterUser)o;
        if (this.meterID > mu.meterID) return 1;
        if (this.meterID < mu.meterID) return -1;
        return 0;
	}
    

}
